//
//  TYSearchBarContainer.m
//  TYUIKit
//
//  Created by TuyaInc on 2019/2/1.
//

#import "TYSearchBarContainer.h"

@implementation TYSearchBarContainer

- (instancetype)initWithSearchBar:(UISearchBar *)searchBar {
    if (self = [super init]) {
        [self addSubview:searchBar];
        if (CGRectEqualToRect(searchBar.bounds, CGRectZero)) {
            [searchBar sizeToFit];
        }
        self.frame = searchBar.bounds;
        _searhBar = searchBar;
    }
    return self;
}

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    return [super pointInside:point withEvent:event] || [_searhBar pointInside:[self convertPoint:point toView:_searhBar] withEvent:event];
}

@end
